﻿Imports System.IO
Imports Microsoft.Win32

Module Program

    Public Sub Main(ByVal args() As String)
        My.Settings.Reload()
        If Not Directory.Exists(My.Settings.Path) Then
            My.Settings.Path = Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyPictures, "Sansa Image Converter")
            'Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
            'My.Settings.Path = Path.Combine(TryCast(key.GetValue("My Pictures"), String), "Sansa Image Converter")
        End If
        My.Settings.Save()

        Application.EnableVisualStyles()
        Application.DoEvents()
        If args Is Nothing Or args.Length <> 1 Then
            Application.Run(New OptionsDialog)
        Else
            Dim dlgWork As New ProgressDialog()
            dlgWork.PathToConvert = args(0)
            dlgWork.ShowDialog()
        End If
    End Sub

End Module
